<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.model.Recepit_description"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.control.RecepitDescriptionControl"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
       request.setCharacterEncoding("UTF-8");
       Recepit_description recepitDescription = new Recepit_description();
       Employees cu=(Employees)session.getAttribute("user");
       int follow_person_id = cu.getId();
       Date dt = new Date(); 
       SimpleDateFormat matter1=new SimpleDateFormat("yyyy-MM-dd");
       String date = matter1.format(dt);
      
       recepitDescription.setRecepit_id(ParamUtil.getInt(request,"recepit_id"));
       recepitDescription.setFollow_person_id(follow_person_id);
       recepitDescription.setDate(ParamUtil.getString(request,"date",date));
       recepitDescription.setContent(ParamUtil.getString(request,"content",""));
       
       System.out.println(follow_person_id);  
       
       System.out.println(recepitDescription.getContent());
       if(RecepitDescriptionControl.addRecepitDescription(recepitDescription)){
           %>
           <script>
           if(window.confirm("跟进成功")){
             window.top.location.href="show_all_recepits.jsp"
           }else{
              window.top.location.href="show_all_recepits.jsp"
           }
           </script>
<%
       }else{
%>
       <script>
       alert("添加失败");
       window.top.location.href="show_all_recepits.jsp"
       </script>
<%
       }
%>
</body>
</html>